package com.cater.sys.controller;
/*package com.cater.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONObject;
import com.cater.annotation.SystemControllerLog;
import com.cater.entity.Goods;
import com.cater.entity.GoodsNodeInfo;
import com.cater.entity.NodeInfo;
import com.cater.entity.User;
import com.cater.entity.UserCollection;
import com.cater.query.CommonQuery;
import com.cater.service.impl.GoodsNodeInfoServiceImpl;
import com.cater.service.impl.GoodsServiceImpl;
import com.cater.service.impl.NodeInfoServiceImpl;
import com.cater.service.impl.UserCollectionServiceImpl;
import com.cater.utils.StringUitl;

*//**
 * @author 作者: sd
 * @溯源绑定节点
 * @version 1.0
 *//*
@Controller
@RequestMapping("/codecollection")
public class UserCollectionController {
	@Autowired
	private GoodsServiceImpl goodsService;
	
	@Autowired
	private UserCollectionServiceImpl userCollectionService;
	
	@Autowired
	private NodeInfoServiceImpl nodeService;
	

	@RequestMapping("/list")
	public String list(Model model,CommonQuery query, HttpServletRequest request) {
		List<Goods> goods =goodsService.getAllCommon(query);
		List<NodeInfo> list = nodeService.getAllCommon(query);
		model.addAttribute("goods", goods);
		model.addAttribute("list", list);
		return "nodebinding/list";
	}
	@RequestMapping(value = "add")
	@RequiresPermissions("nodebinding:add")
	@ResponseBody
	@SystemControllerLog(description = "收藏节点")
	public JSONObject add(UserCollection userCollection,HttpServletRequest request)  {
		User user =StringUitl.getUser(request);
		userCollection.setUserId(user.getId().toString());
		userCollectionService.getByUserAndNode(userCollection.getUserId(), userCollection.getNodeId());
		JSONObject json = new JSONObject();
		try {
			UserCollection usercoll = userCollectionService.getByUserAndNode(userCollection.getUserId(), userCollection.getNodeId());
			if(usercoll!=null){
				json.put("code", 999);
				json.put("message", "已经收藏了该节点，不用重复收藏！");
			}else{
				userCollectionService.save(userCollection);
				json.put("code", 200);
				json.put("message", "收藏成功！");
			}
		} catch (Exception e) {
			e.printStackTrace();
			json.put("code", 999);
			json.put("message", "收藏失败！");
		}
		return json;
	}
	
	
	@RequestMapping(value = "add")
	@RequiresPermissions("nodebinding:add")
	@ResponseBody
	@SystemControllerLog(description = "取消收藏")
	public JSONObject delete(String userid,String nodeid,HttpServletRequest request)  {
		User user =StringUitl.getUser(request);
		JSONObject json = new JSONObject();
		try {
			userCollectionService.delete(userid, nodeid);
			json.put("code", 200);
			json.put("message", "收藏成功！");
		} catch (Exception e) {
			e.printStackTrace();
			json.put("code", 999);
			json.put("message", "收藏失败！");
		}
		return json;
	}

}
*/